/**
 * 自定义组件控件默认显示图片 名称 标识
 * @type {[{name: *, value, key: string}, {name: *, value, key: string}, {name: *, value, key: string}, {name: *, value, key: string}, {name: *, value, key: string}, null, null, null, null, null, null, null, null]}
 */
import i18LangUtil from "@/language/lang/i18LangUtil";

const controlList=[
    {
        key:'form',
        value:getImage('/image/formCustom/big-module-form.png'),
        name:i18n('formCompo','表单组件')
    },
    {
        key:'list',
        value:getImage('/image/formCustom/module-list.png'),
        name:i18n('listCompo','列表组件')
    },
    {
        key:'tree',
        value:getImage('/image/formCustom/module-tree.png'),
        name:i18n('treeCompo','树形组件')
    },
    {
        key:'chart',
        value:getImage('/image/formCustom/module-chart.png'),
        name:i18n('chartCompo','图表组件')
    },
    {
        key:'tab',
        value:getImage('/image/formCustom/module-tab.png'),
        name:i18n('tabCompo','tab组件')
    },
    {
        key:'tabContainer',
        value:getImage('/image/formCustom/module-tab.png'),
        name:i18n('tabContainerCompo','tab容器')
    },
    {
        key:'ureport',
        value:getImage('/image/formCustom/module-ureport.png'),
        name:i18n('uReportCompo','ureport组件')
    },
    {
        key:'custom',
        value:getImage('/image/formCustom/module-custom.png'),
        name:i18n('customCompo','自定义组件')
    },
    {
        key:'calendar',
        value:getImage('/image/formCustom/module-calendar.png'),
        name:i18n('calCompo','日历组件')
    },
    {
        key:'filter',
        value:getImage('/image/formCustom/module-filter.png'),
        name:i18n('filterCompo','筛选器组件')
    },
    {
        key:'quillEditor',
        value:getImage('/image/formCustom/module-quillEditor.png'),
        name:i18n('richTextCompo','富文本组件')
    },
    {
        key:'carousel',
        value:getImage('/image/formCustom/module-carousel.png'),
        name:i18n('wheelCompo','轮播图组件')
    },
    {
        key:'bpm',
        value:getImage('/image/formCustom/big-module-form.png'),
        name:i18n('bpmCompo','流程组件')
    }
]

/**
 * 获取图片路径
 * @param url
 * @returns {*}
 */
function getImage(url) {
    return import.meta.env.JPAAS_BASE_URL + url;
}

/**
 * 国际化
 * @param name
 * @param text
 * @param key
 * @returns {*|string}
 */
function i18n(name, text, key) {
    let lang=localStorage.getItem("language") || "zh-CN";
    let langObj=i18LangUtil.langeFilesHandler(lang);
    return langObj["formCustom"][name] || text || "";
}

export { controlList }
